﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace EbayMaster
{
    public partial class FrmTransactionDetail : Form
    {
        public EbayTransactionType Transaction = null;

        public FrmTransactionDetail()
        {
            InitializeComponent();
        }

        private void FrmTransactionDetail_Load(object sender, EventArgs e)
        {
            if (Transaction == null)
                return;

            this.textBoxItemTitle.Text = Transaction.ItemTitle;
            this.textBoxPriceAndQuantity.Text = string.Format("{0} x {1}={2}", 
                Transaction.ItemPrice, Transaction.SaleQuantity, Transaction.ItemPrice * Transaction.SaleQuantity);
            this.textBoxBuyerId.Text = string.Format("{0} {1}", Transaction.BuyerId, Transaction.BuyerCountry);
            this.textBoxBuyerEmail.Text = Transaction.BuyerMail;
            this.textBoxBuyerAddress.Text = Transaction.BuyerName + "\r\n" +Transaction.BuyerAddress;
            this.textBoxPaidTime.Text = Transaction.IsPaid ? Transaction.PaidDate.ToShortDateString() : "NA";
            this.textBoxShippingTime.Text = Transaction.IsShipped ? Transaction.ShippedDate.ToShortDateString() : "NA";
        }

        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            if (keyData == Keys.Escape)
                this.Close();
            return base.ProcessCmdKey(ref msg, keyData); 
        } 

    }
}
